class SessionsController < ApplicationController
 
 def index
  redirect_to :action => "login"
 end
 
 def login
  redirect_to Authorize.login_url
 end
 
 def logout
  session[:token_key] = nil
  session[:user_id] = nil
  flash[:notice] = "Successfully logged in"
  redirect_to Authorize.logout_url
 end
 
 def callback
  request_token = Authorize.request_token(params[:ticket_key])
  if !request_token or !request_token[:key]
    redirect_to :controller => '/'
    return
  end
  session[:token_key] = request_token[:key]
  flash[:notice] = 'Logged in successfully'
  redirect_to :controller => '/'
 end
 
end
